import Vue from "vue";
import VueRouter from 'vue-router'
import UserManagePage from '@/components/UserManagePage.vue'
import PowerManagePage from '@/components/PowerManagePage.vue'
import SystemSettingPage from '@/components/SystemSettingPage.vue'
import LoginPage from "@/components/LoginPage.vue";
import System from '@/components/SystemPage.vue'
import GoodsList from "@/components/GoodsList.vue";
import ShopCarPage from "@/components/ShopCarPage.vue";

// 1 使用
Vue.use(VueRouter)

// 2 配置
const routes = [
    {
        path: '/domain',
        component: System,
        children: [
                {
                    path: '/user',
                    component: UserManagePage
                },
                {
                    path: '/power',
                    component: PowerManagePage
                },
                {
                    path: '/order',
                    component: ShopCarPage
                },
                {
                    path: '/system',
                    component: SystemSettingPage
                },
                {
                    path: '/goods',
                    component: GoodsList
                }
        ]
    },
    {
        path: '/login',
        component: LoginPage
    },
    {
        path: '/',
        redirect: '/login'
    },
]

// 3 实例化并导出
export default new VueRouter({
    routes
})

